package com.lzy.crm.controller;


import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lzy.crm.base.date.DateUtil;
import com.lzy.crm.base.page.PageQuery;
import com.lzy.crm.base.util.BootStrapReturn;
import com.lzy.crm.base.util.JsonUtil;
import com.lzy.crm.base.util.Md5Util;
import com.lzy.crm.base.util.StringUtil;
import com.lzy.crm.domain.BankCard;
import com.lzy.crm.domain.ProfitRule;
import com.lzy.crm.domain.User;
import com.lzy.crm.service.BankCardService;
import com.lzy.crm.service.CardFlowService;
import com.lzy.crm.service.OrderService;
import com.lzy.crm.service.ProfitRuleService;
import com.lzy.crm.service.ProfitService;
import com.lzy.crm.service.UserService;
import com.lzy.crm.util.BootJsonResponse;
import com.lzy.crm.util.MenusUtil;
import com.lzy.crm.util.SessionManager;
import com.lzy.crm.util.UserConstants;
import com.lzy.crm.vo.AgentUser;
import com.lzy.crm.vo.LoginInfo;
import com.lzy.crm.vo.OrderStatVo;
import com.lzy.crm.vo.PlayerInfo;




/**
 * 用户控制器
 * @author chenshiping
 *
 */
//@Controller
//@RequestMapping("/admin1")
public class UserController {
	Logger logger= Logger.getLogger(UserController.class);
	
	
	@Resource
	private UserService userService;
	
	@Resource
	private CardFlowService cardFlowService;
	
	@Resource
	private BankCardService bankCardService;
	
	@Resource
	OrderService orderService; 
	
	@Resource
	ProfitService profitService;
	
	@Resource
	ProfitRuleService profitRuleService;
	
	/**
	 * 登录
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/login",produces="text/html;charset=UTF-8")
	public String login(HttpServletRequest request,ModelMap model) throws Exception{
		String msg="";
		if(request.getParameter("loginNo")==null){
			return "../../login";
		}
		try {
			String loginNo = request.getParameter("loginNo").toString();
			String password =request.getParameter("password").toString();
			String mobile = request.getParameter("mobile").toString();
			String randCheckCode = request.getParameter("randCheckCode");
			
			//加入验证码
			Integer loginCount = request.getSession().getAttribute(UserConstants.LOGIN_COUNT)==null?1:
				(Integer) request.getSession().getAttribute(UserConstants.LOGIN_COUNT);
			request.getSession().setAttribute(UserConstants.LOGIN_COUNT, loginCount+1 );
			if(loginCount >= UserConstants.LOGIN_NUB){
				String verifyCode =(String)request.getSession().getAttribute(UserConstants.VERIFY_CODE_PREFIX);
				if(!StringUtils.equals(randCheckCode, verifyCode)){
					msg ="验证码错误";
					model.put("loginNo", loginNo);
					model.put("password", password);
					model.put("message", msg);
					return "../../login";
				}
			}
			
			List<User> userList = null;
			userList =userService.getUserListByEmailAndPwd(loginNo);
			if(userList==null||userList.size()==0){
				userList =userService.getUserListByPhoneAndPwd(loginNo);
			}
			if(userList==null||userList.size()==0){
				logger.info(loginNo+": 用户名或者密码错误");
				msg ="用户名或者密码错误";
			}else if(userList.size()>1){
				logger.info(loginNo+": 登录帐号重复，请联系管理员");
				msg ="登录帐号重复，请联系管理员";
			}else{
				User user = userList.get(0);
				if(StringUtil.equals(Md5Util.encode("123456"), user.getPassword())){
					logger.info(loginNo+": 请在公众号修改默认密码 123456 ，即可登陆~~ ");
					msg =" 请在郴州互娱公众号菜单 代理后台 修改默认密码 123456 ，即可登陆~~ ";
				}else if(StringUtil.equals(Md5Util.encode(password), user.getPassword())){
					if(StringUtil.equals(user.getStatus(), UserConstants.USER_STATUS_NORMAL)
							){
						// 登录成功
						model.put("user", user);
						// 登录信息 写入session
						request.getSession().setMaxInactiveInterval(1800);  // 30 分钟失效
						request.getSession().setAttribute("userSession", user);
						request.getSession().setAttribute(UserConstants.LOGIN_COUNT, 0 );
						// 存入信息
						LoginInfo loginInfo=new LoginInfo();
						//loginInfo.setUser(user);
						SessionManager.setLoginInfo(loginInfo);
						// 区分超管权限
						if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
							request.getSession().setAttribute("menusSession", MenusUtil.menusType_3);
						}else{
							request.getSession().setAttribute("menusSession", MenusUtil.menusType_1);
						}
						if(StringUtil.equals("1", mobile)){
							return "redirect:index_mobile.html"; // 手机端
						}else{
							return "redirect:index.html"; //  PC端
						}
					}else if(StringUtil.equals(user.getStatus(), UserConstants.USER_STATUS_INIT)){
						logger.info(loginNo+": 帐号未激活，请联系管理员");
						msg ="帐号未激活，请联系管理员";
					}else{
						logger.info(loginNo+": 帐号已被注销");
						msg ="账号已封禁，请联系管理员~";
					}
				}else{
					logger.info(loginNo+": 用户名或者密码错误");
					msg ="用户名或者密码错误";
				}
			}
		} catch (Exception e) {
			logger.error("登录出错", e);
		}
		model.put("message", msg);
		return "../../login";
	}
	
	/**
	 * 主页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/index")  
	public String index() {
		return "index";
	}
	
	
	/**
	 * 退出登录
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/logout")  
	public String logout(HttpServletRequest request,ModelMap model) {
		request.getSession().removeAttribute("userSession");
		return "../../login";
	}
	
	
	/**
	 * 修改密码页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/updatepwd")  
	public String updatepwd(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		model.put("user", user);
		return "user/user_edit_pwd";
	}
	
	/**
	 * 修改密码
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping(path="/updatepwd_save",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String doUpdatepwd(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			String newPwd = request.getParameter("newPassword");
			String oldPwd = request.getParameter("oldPassword");
			User user = (User)request.getSession().getAttribute("userSession");
			User newUser =userService.getById(user.getId());
			if(StringUtil.equals(Md5Util.encode(oldPwd), newUser.getPassword())){
				user.setPassword(Md5Util.encode(newPwd));
				userService.updateByPrimaryKeySelective(user);
				bootJsonResponse.setMessage("操作成功");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
			}else{
				// 旧密码输入错误
				bootJsonResponse.setMessage("旧密码输入错误");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			}
		} catch (Exception e) {
			bootJsonResponse.setMessage("系统异常，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改密码失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	
	
	/**
	 * 个人信息界面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_info")  
	public String userInfo(HttpServletRequest request,ModelMap model) {
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			User newUser = userService.getById(user.getId());
			LoginInfo loginInfo = SessionManager.getLoginInfo();
			// 总共转出卡数
			Integer totalCard = cardFlowService.getCardinflow(newUser.getId(), null, null);
			// 昨日转出卡数
			String yesterday = DateUtil.formatDateWithoutTime(DateUtil.getNextDay(new Date()));
			String startTime = yesterday +" 00:00:00" ;
			String entTime = yesterday +" 23:59:59";
			Integer yesterdayCard = cardFlowService.getCardinflow(newUser.getId(), startTime, entTime);
			// 父级信息
			User parentUser = userService.getById(newUser.getParentId());
			model.put("totalCard", totalCard);
			model.put("yesterdayCard", yesterdayCard);
			model.put("user", newUser);
			model.put("parentUser", parentUser);
		} catch (Exception e) {
			logger.error("个人信息界面", e);
		}
		return "user/user_info";
	}
	
	/**
	 * 个人信息保存
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_info_edit",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String doEditUser(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			String outUserName=request.getParameter("outUserName");
			User user = (User)request.getSession().getAttribute("userSession");
			User newUser=userService.getById(user.getId());
			newUser.setOutUserId(outUserName);
			userService.updateByPrimaryKeySelective(newUser);
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	/**
	 * 下级用户列表
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_next_info")  
	public String userNextInfo(HttpServletRequest request,ModelMap model) {
		return "user/user_next_info";
	}
	

	
		
	/**
	 * 代理列表
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_next_info_data",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String userNextInfoData(HttpServletRequest request, @RequestParam Map<String, String> form,
			ModelMap model) {
		BootStrapReturn<AgentUser> result = new BootStrapReturn<AgentUser>();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			String phone = request.getParameter("phone");
			String status =request.getParameter("status");
			Integer currentPage = Integer.parseInt(request.getParameter("numPerPage"));
			Integer numPerPage = Integer.parseInt(request.getParameter("pageNum"));
			PageQuery pageQuery = new PageQuery(numPerPage,currentPage);
			pageQuery.setIsQueryTotal(true); 
			List<AgentUser> agentUserList =userService.getAgentUserList(user.getId(), phone, status,pageQuery);
			result.setPage(pageQuery.getPageIndex());
			result.setTotal(pageQuery.getTotalCount());
			result.setRows(agentUserList);
		} catch (Exception e) {
			logger.error("代理列表", e);
		}
		return JsonUtil.toJson(result) ;
	}
	

	@RequestMapping("/user_add")  
	public String userAdd(HttpServletRequest request,ModelMap model) {
		return "user/user_add";
	}
	
	
	/**
	 * 添加下级代理
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_save",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String userSave(HttpServletRequest request, 
			ModelMap model) {
		BootJsonResponse response=new BootJsonResponse();
		try{
			User user = (User)request.getSession().getAttribute("userSession");
			String userName = request.getParameter("userName");
			String phone = request.getParameter("phone");
			String email = request.getParameter("email");
			String remark = request.getParameter("remark");
			String gameId = request.getParameter("gameId");
			String outUserName = request.getParameter("outUserName");
			String userLevel = request.getParameter("userLevel");
			String bankUserNo =request.getParameter("bankUserNo");
			
			List<User> userList = userService.getUserByGameId(gameId);
			
			
			if(userList!=null&&userList.size()>0
					&&StringUtil.equals(userList.get(0).getUserType(), UserConstants.USER_TYPE_AGENT)
					){
				response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				response.setMessage("该用户已是代理商");
				return JsonUtil.toJson(response) ;
			}
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				if(userList!=null&&userList.size()>0&&userList.get(0).getParentId()!=0){
					if( userList.get(0).getParentId()!= user.getId() ){
						response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
						response.setMessage("该用户已绑定其他的邀请人,请该用户在微信公众号申请。");
						return JsonUtil.toJson(response) ;
					}
				}
			}
			
			if((phone==null||StringUtil.equals(phone, ""))&&(email==null||StringUtil.equals(email, ""))){
				response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				response.setMessage("邮箱和手机不能同时为空");
				return JsonUtil.toJson(response) ;
			}else{
				if(StringUtil.isNotEmpty(email)){
					List<User> emailList = userService.getUserListByEmailAndPwd(email);
					if(emailList.size()>0){
						response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
						response.setMessage("邮箱已被占用，请换一个邮箱 ");
						return JsonUtil.toJson(response) ;
					}
				}
				List<User> phoneList =userService.getUserListByPhoneAndPwd(phone);
				if(phoneList.size()>0){
					if(userList!=null&&userList.size()>0){
						if(!StringUtil.equals(phoneList.get(0).getUnionid(), userList.get(0).getUnionid())){
							response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
							response.setMessage("手机号码已被占用，请换一个手机号码 ");
							return JsonUtil.toJson(response) ;
						}
					}else{
						response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
						response.setMessage("手机号码已被占用，请换一个手机号码 ");
						return JsonUtil.toJson(response) ;
					}
				}
				Integer userId = null;
				User newUser =new User();
				if(StringUtil.isNotEmpty(gameId)){
					newUser.setGameUserId(Integer.parseInt(gameId));  // 绑定玩家ID
				}
				PlayerInfo playerInfo = userService.getPlayerInfo(Integer.parseInt(gameId), null);
				if(playerInfo!=null){
					newUser.setUnionid(playerInfo.getUnionid());
				}else{
					response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
					response.setMessage("找不到该玩家，创建失败~~");
					return JsonUtil.toJson(response) ;
				}
				newUser.setUserName(userName);
				newUser.setPhone(phone);
				newUser.setUserLevel(userLevel);
				newUser.setUserType(UserConstants.USER_TYPE_AGENT);
				newUser.setEmail(email);
				newUser.setPassword(Md5Util.encode("123456"));
				newUser.setRemark(remark);
				newUser.setParentId(user.getId());
				newUser.setUpParentId(user.getParentId());
				newUser.setTotalCard(0);
				newUser.setScore(0);
				newUser.setCreateTime(new Date());
				newUser.setStatus("0");
				newUser.setTiceng(0.0);
				newUser.setOutUserName(outUserName);
				newUser.setParentNub(0);
				newUser.setUpParentNub(0);
				if(userList!=null){
					User oldUser =userList.get(0);
					userId=oldUser.getId();
					oldUser.setUserName(userName);
					oldUser.setPhone(phone);
					oldUser.setUserLevel(userLevel);
					oldUser.setUserType(UserConstants.USER_TYPE_AGENT);
					oldUser.setEmail(email);
					//oldUser.setPassword(Md5Util.encode("123456"));
					oldUser.setRemark(remark);
					if(oldUser.getParentId()==null){
						oldUser.setParentId(user.getId());
					}
					if(oldUser.getUpParentId()==null){
						oldUser.setUpParentId(user.getParentId());
					}
					//oldUser.setTotalCard(0);
					//oldUser.setScore(0);
					oldUser.setUpdateTime(new Date());
					//oldUser.setStatus("0");
					//oldUser.setTiceng(0.0);
					// 超级管理员默认激活
					if(StringUtil.equals( user.getUserType(),UserConstants.USER_TYPE_MANAGE)){
						oldUser.setStatus("1");
					}
					userService.updateByPrimaryKeySelective(oldUser);
				}else{
					// 超级管理员 默认激活
					if(StringUtil.equals( user.getUserType(),UserConstants.USER_TYPE_MANAGE)){
						newUser.setStatus("1");
					}
					userService.insertSelective(newUser);
					userId = newUser.getId();
				}
				// 添加银行卡信息
				if(StringUtil.isNotEmpty(bankUserNo)){
					BankCard bankCard = new BankCard();
					List<BankCard> bankCardList =bankCardService.getBankCardListByUserId(userId.toString());
					if(bankCardList!=null&&bankCardList.size()>0){
						bankCard = bankCardList.get(0);
						bankCard.setBankName("支付宝");
						bankCard.setBankUserNo(bankUserNo);
						bankCard.setBankUserName(userName);
						bankCard.setUpdateTime(new Date());
						bankCardService.updateByPrimaryKeySelective(bankCard);
					}else{
						bankCard.setUserId(userId);
						bankCard.setBankName("支付宝");
						bankCard.setBankUserNo(bankUserNo);
						bankCard.setBankUserName(userName);
						bankCard.setCardFlag("1"); // 默认启用
						bankCard.setCreateTime(new Date());
						bankCardService.insertSelective(bankCard);
					}
					
				}
				response.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
				response.setMessage("添加成功");
			}
		}catch(Exception e){
			response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			response.setMessage("添加失败，请与管理员联系");
			logger.error("添加代理商失败", e);
		}
		return JsonUtil.toJson(response) ;
	}
	
	@RequestMapping("/users_info")
	@ResponseBody
	public String usersInfo(HttpServletRequest request,ModelMap model) {
		try {
			
			model.put("state", "0");
			User user = (User)request.getSession().getAttribute("userSession");
			model.put("user", user);
			User puser = userService.getById(user.getParentId());
			if(puser!=null){
				puser.setPassword(null);
				model.put("puser", puser);
			}
			model.put("state", "1");
		} catch (Exception e) {
			logger.error("用户信息", e);
		}
		return JsonUtil.toJson(model);
	}
	
	
	/**
	 * 用户列表(超管权限)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_list")  
	public String usersList(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
			return "user/user_list";
		}
		return "user/user_next_info";
	}
	
	/**
	 * 代理列表  用户列表(超管权限)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_list_data",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String userListData(HttpServletRequest request, @RequestParam Map<String, String> form,
			ModelMap model) {
		BootStrapReturn<AgentUser> result = new BootStrapReturn<AgentUser>();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			String phone = request.getParameter("phone");
			String status =request.getParameter("status");
			Integer currentPage = Integer.parseInt(request.getParameter("numPerPage"));
			Integer numPerPage = Integer.parseInt(request.getParameter("pageNum"));
			PageQuery pageQuery = new PageQuery(numPerPage,currentPage);
			pageQuery.setIsQueryTotal(true); 
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				return "";
			}
			List<AgentUser> agentUserList =userService.getAllAgentUserList(user.getId(), phone, status,pageQuery);
			result.setPage(pageQuery.getPageIndex());
			result.setTotal(pageQuery.getTotalCount());
			result.setRows(agentUserList);
		} catch (Exception e) {
			logger.error("代理列表", e);
		}
		return JsonUtil.toJson(result) ;
	}
	
	
	/**
	 * 修改代理商状态
	 * @param request
	 * @param form
	 * @param model
	 * @return
	 */
	@RequestMapping(path="/user_list_status",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String usersInfoStatus(HttpServletRequest request,@RequestParam Map<String, String> form,ModelMap model) {
		BootJsonResponse response=new BootJsonResponse();
		try {
			String userId = form.get("userId");
			String status = form.get("status");
			User user = (User)request.getSession().getAttribute("userSession");
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				response.setMessage(" 权限不够，请联系管理员 ");
				return JsonUtil.toJson(response); 
			}
			User nuser = userService.getById(userId);
			nuser.setStatus(status);
			userService.updateByPrimaryKeySelective(nuser);
			response.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
			response.setMessage("操作成功~");
		} catch (Exception e) {
			logger.error(" 删启用户信息 ", e);
			response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			response.setMessage(" 系统错误，请联系管理员 ");
		}
		return JsonUtil.toJson(response);
	}

	/**
	 * 添加银行卡页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/update_bank")  
	public String updateBank(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		model.put("user", user);
		try {
			List<BankCard> bankCardList =bankCardService.getBankCardListByUserId(user.getId().toString());
			if(bankCardList!=null&&bankCardList.size()>0){
				model.put("bankCard", bankCardList.get(0));
			}
		} catch (Exception e) {
			logger.error("查询银行卡错误", e);
		}
		return "user/user_edit_bank";
	}
	
	/*********  PC 端页面控制器   **************/
	
	
	
	
	
	
	
	/********  手机兼用页面 *********/
	
	
	/**
	 * 主页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/index_mobile")  
	public String indexMobile() {
		return "mobile/index";
	}
	/**
	 * 代理商主界面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_main_mobile")  
	public String userMian(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		model.put("addAgent", 1);
		if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_AGENT)
				&&StringUtil.equals(user.getUserLevel(), UserConstants.USER_LEVEL_TGDS) ){
			model.put("addAgent", 2);
		}
		return "mobile/user/user_main";
	}
	
	/**
	 * 添加代理商
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_add_mobile")  
	public String userAddMobile(HttpServletRequest request,ModelMap model){
		User user = (User)request.getSession().getAttribute("userSession");
		String prifitLevel = user.getUserType();
		if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
			prifitLevel=null;
		}
		List<ProfitRule> profitRule = profitRuleService.getProfitRuleList(null, prifitLevel);
		model.put("profitRule", profitRule);
		return "mobile/user/user_add";
	}
	
	
	/**
	 * 下级用户列表
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_next_info_mobile")  
	public String userNextInfo_mobile(HttpServletRequest request,ModelMap model) {
		return "mobile/user/user_next_info";
	}
	
	
	
	/**
	 * 个人信息界面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_info_mobile")  
	public String userInfoMobile(HttpServletRequest request,ModelMap model) {
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			User newUser= userService.getById(user.getId());
			// 总共转出卡数
			Integer totalCard = cardFlowService.getCardinflow(user.getGameUserId(), null, null);
			// 昨日转出卡数
			String yesterday = DateUtil.formatDateWithoutTime(DateUtil.getNextDay(new Date()));
			String startTime = yesterday +" 00:00:00" ;
			String entTime = yesterday +" 23:59:59";
			Integer yesterdayCard = cardFlowService.getCardinflow(user.getGameUserId(), startTime, entTime);
			// 父级信息
			User parentUser = userService.getById(user.getParentId());
			// 剩余房卡
			PlayerInfo playerInfo=userService.getPlayerInfo(null, user.getUnionid());
			if(playerInfo!=null){
				model.put("playerTotalCard", playerInfo.getInsureScore());
				if(newUser.getGameUserId()==null||newUser.getGameUserId()!=playerInfo.getGameId()){
					newUser.setGameUserId(playerInfo.getGameId());
					newUser.setAgentId(playerInfo.getGameId());
					userService.updateByPrimaryKeySelective(newUser);
				}
			}
			// 近15日分润汇总
			String towWeek =DateUtil.formatDateWithoutTime(DateUtil.getCountDay(new Date(), -15));
			Integer profitFee = profitService.getProfitStat(user.getId(), towWeek, null);
			ProfitRule profitRule = profitRuleService.getById(newUser.getUserLevel());
			model.put("profitRule", profitRule);
			model.put("profitFee", profitFee);
			model.put("totalCard", totalCard);
			model.put("yesterdayCard", yesterdayCard);
			model.put("user", newUser);
			model.put("parentUser", parentUser);
		} catch (Exception e) {
			logger.error("个人信息界面", e);
		}
		return "mobile/user/user_info";
	}
	
	/**
	 * 超级管理员信息界面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_admin_info_mobile")  
	public String userAdminInfoMobile(HttpServletRequest request,ModelMap model) {
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			User newUser = userService.getById(user.getId());
			// 总共转出卡数
			Integer totalCard = cardFlowService.getCardinflow(newUser.getGameUserId(), null, null);
			// 昨日转出卡数
			String yesterday = DateUtil.formatDateWithoutTime(DateUtil.getNextDay(new Date()));
			String startTime = yesterday +" 00:00:00" ;
			String entTime = yesterday +" 23:59:59";
			Integer yesterdayCard = cardFlowService.getCardinflow(newUser.getGameUserId(), startTime, entTime);
			
			// 昨日充值统计
			OrderStatVo yesterdayrderStatVo = orderService.getOrderStatVo(null, "1", startTime, entTime);
			// 累积充值
			OrderStatVo allrderStatVo = orderService.getOrderStatVo(null, "1", null, null);
			// 近15日充值
			String towWeek =DateUtil.formatDateWithoutTime(DateUtil.getCountDay(new Date(), -15));
			OrderStatVo twoWeekorderStatVo = orderService.getOrderStatVo(null, "1", towWeek, null);
			
			PlayerInfo playerInfo=userService.getPlayerInfo(user.getGameUserId(), null);
			if(playerInfo!=null){
				model.put("playerTotalCard", playerInfo.getInsureScore());
				if(newUser.getGameUserId()==null||newUser.getGameUserId()!=playerInfo.getGameId()){
					newUser.setGameUserId(playerInfo.getGameId());
					newUser.setAgentId(playerInfo.getGameId());
					userService.updateByPrimaryKeySelective(newUser);
				}
			}
			// 近15日分润汇总
			Integer profitFee = profitService.getProfitStat(user.getId(), towWeek, null);
			ProfitRule profitRule = profitRuleService.getById(newUser.getUserLevel());
			model.put("profitRule", profitRule);
			model.put("profitFee", profitFee);
			model.put("yesterdayrderStatVo", yesterdayrderStatVo);
			model.put("allrderStatVo", allrderStatVo);
			model.put("twoWeekorderStatVo", twoWeekorderStatVo);
			model.put("totalCard", totalCard);
			model.put("yesterdayCard", yesterdayCard);
			model.put("user", newUser);
		} catch (Exception e) {
			logger.error("个人信息界面", e);
		}
		return "mobile/user/user_admin_info";
	}
	
	
	/**
	 * 修改密码页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/updatepwd_mobile")  
	public String updatepwdMobile(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		model.put("user", user);
		return "mobile/user/user_edit_pwd";
	}
	
	/**
	 * 添加银行卡页面
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/update_bank_mobile")  
	public String updateBankMobile(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		model.put("user", user);
		try {
			List<BankCard> bankCardList =bankCardService.getBankCardListByUserId(user.getId().toString());
			if(bankCardList!=null&&bankCardList.size()>0){
				model.put("bankCard", bankCardList.get(0));
			}
		} catch (Exception e) {
			logger.error("查询银行卡错误", e);
		}
		return "mobile/user/user_edit_bank";
	}
	
	
	@RequestMapping(path="/update_bank_save_mobile",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String saveBank(HttpServletRequest request,@RequestParam Map<String, String> form,ModelMap model) {
		BootJsonResponse response=new BootJsonResponse();
		try {
			String bankName = form.get("bankName");
			String bankUserNo = form.get("bankUserNo");
			String bankUserName = form.get("bankUserName");
			User user = (User)request.getSession().getAttribute("userSession");
			BankCard bankCard = new BankCard();
			
			List<BankCard> bankCardList =bankCardService.getBankCardListByUserId(user.getId().toString());
			if(bankCardList!=null&&bankCardList.size()>0){
				bankCard = bankCardList.get(0);
				bankCard.setBankName(bankName);
				bankCard.setBankUserNo(bankUserNo);
				bankCard.setBankUserName(bankUserName);
				bankCard.setUpdateTime(new Date());
				bankCardService.updateByPrimaryKeySelective(bankCard);
			}else{
				bankCard.setUserId(user.getId());
				bankCard.setBankName(bankName);
				bankCard.setBankUserNo(bankUserNo);
				bankCard.setBankUserName(bankUserName);
				bankCard.setCardFlag("1"); // 默认启用
				bankCard.setCreateTime(new Date());
				bankCardService.insertSelective(bankCard);
			}
			
			response.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
			response.setMessage("操作成功~");
		} catch (Exception e) {
			logger.error(" 添加银行卡信息 ", e);
			response.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			response.setMessage(" 系统错误，请联系管理员 ");
		}
		return JsonUtil.toJson(response);
	}
	
	
	/**
	 * 用户列表(超管权限)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_list_mobile")  
	public String usersListMobile(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
			return "mobile/user/user_list";
		}
		return "mobile/user/user_next_info";
	}
	
	/**
	 * 用户列表(超管权限)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_list_apply_mobile")  
	public String usersListApplyMobile(HttpServletRequest request,ModelMap model) {
		User user = (User)request.getSession().getAttribute("userSession");
		if(StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
			return "mobile/user/user_list_apply";
		}
		return "mobile/user/user_next_info";
	}
	
	
	
	/**
	 * 上下级
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping("/user_parent_mobile")  
	public String usersParentMobile(HttpServletRequest request,ModelMap model) {
		return "mobile/user/user_parent";
	}
	
	@RequestMapping("/user_up_parent_mobile")  
	public String usersUpParentMobile(HttpServletRequest request,ModelMap model) {
		return "mobile/user/user_up_parent";
	}
	
	/**
	 * 一二级代理列表
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_parent_mobile_data",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String userParentData(HttpServletRequest request, @RequestParam Map<String, String> form,
			ModelMap model) {
		BootStrapReturn<User> result = new BootStrapReturn<User>();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			String gameId = request.getParameter("gameId");
			String type =request.getParameter("type");
			Integer currentPage = Integer.parseInt(request.getParameter("numPerPage"));
			Integer numPerPage = Integer.parseInt(request.getParameter("pageNum"));
			PageQuery pageQuery = new PageQuery(numPerPage,currentPage);
			pageQuery.setIsQueryTotal(true); 
			Integer parentId =null;
			Integer upParentId =null;
			if(StringUtil.equals(type, "1")){
				parentId = user.getId();
			}else{
				upParentId = user.getId();
			}
			List<User> playerUserList = userService.getAllPlayerUserList(parentId, upParentId, gameId,pageQuery);
			if(StringUtil.equals(type, "1")){ // 修复邀请数不一致数据
				if(pageQuery.getTotalCount()!=user.getParentNub()){
					User newUser= userService.getById(user.getId());
					newUser.setParentNub(pageQuery.getTotalCount());
					userService.updateByPrimaryKeySelective(newUser);
				}
			}else{
				if(pageQuery.getTotalCount()!=user.getUpParentNub()){
					User newUser= userService.getById(user.getId());
					newUser.setUpParentNub(pageQuery.getTotalCount());
					userService.updateByPrimaryKeySelective(newUser);
				}
			}
			result.setPage(pageQuery.getPageIndex());
			result.setTotal(pageQuery.getTotalCount());
			result.setRows(playerUserList);
		} catch (Exception e) {
			logger.error("代理列表", e);
		}
		return JsonUtil.toJson(result) ;
	}
	
	/**
	 * 个人信息保存
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_edit_password",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String doEditUserPassword(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				bootJsonResponse.setMessage(" 权限不够，请联系管理员 ");
				return JsonUtil.toJson(bootJsonResponse); 
			}
			String userId =request.getParameter("userId");
			User newUser=userService.getById(userId);
			newUser.setPassword(Md5Util.encode("123456"));
			userService.updateByPrimaryKeySelective(newUser);
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	
	
	/**
	 * 个人信息保存
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_edit_agentId",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String doEditUserAgent(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				bootJsonResponse.setMessage(" 权限不够，请联系管理员 ");
				return JsonUtil.toJson(bootJsonResponse); 
			}
			String userId =request.getParameter("userId");
			String strAgentId = request.getParameter("agentId");
			if(StringUtil.isEmpty(strAgentId)){
				bootJsonResponse.setMessage("靓号不能为空~");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				return JsonUtil.toJson(bootJsonResponse);
			}
			User newUser=userService.getById(userId);
			Integer agentId = Integer.parseInt(strAgentId);
			if(agentId>100000){
				bootJsonResponse.setMessage("靓号不能超过6位 ~");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				return JsonUtil.toJson(bootJsonResponse);
			}
			// 判断是否被占用
			User gameUser = userService.getUserInfoByGameid(strAgentId);
			User agentUser = userService.getUserInfoByAgentId(strAgentId);
			if(gameUser!=null ){
				if(gameUser.getId()==user.getId()){
					bootJsonResponse.setMessage(strAgentId +" 已经是 玩家 "+user.getGameUserId()+"的邀请码");
					bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
					return JsonUtil.toJson(bootJsonResponse);
				}else{
					bootJsonResponse.setMessage(strAgentId +" 该邀请码已被占用，请更换邀请码~ ");
					bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
					return JsonUtil.toJson(bootJsonResponse);
				}
			}
			if(agentUser!=null ){
				if(agentUser.getId()==user.getId()){
					bootJsonResponse.setMessage(strAgentId +" 已经是 玩家 "+user.getGameUserId()+"的邀请码");
					bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
					return JsonUtil.toJson(bootJsonResponse);
				}else{
					bootJsonResponse.setMessage(strAgentId +" 该邀请码已被占用，请更换邀请码~ ");
					bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
					return JsonUtil.toJson(bootJsonResponse);
				}
				
			}
			
			newUser.setAgentId(agentId);
			userService.updateByPrimaryKeySelective(newUser);
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	
	/**
	 * 玩家列表(超管权限)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/user_player_list_mobile")  
	public String userPlayerListMobile(HttpServletRequest request,ModelMap model) {
		return "mobile/user/user_player_list";
	}
	
	/**
	 * 超管玩家列表
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_player_mobile_data",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String userPlayerData(HttpServletRequest request, @RequestParam Map<String, String> form,
			ModelMap model) {
		BootStrapReturn<User> result = new BootStrapReturn<User>();
		try {
			String gameId = request.getParameter("gameId");
			Integer currentPage = Integer.parseInt(request.getParameter("numPerPage"));
			Integer numPerPage = Integer.parseInt(request.getParameter("pageNum"));
			PageQuery pageQuery = new PageQuery(numPerPage,currentPage);
			pageQuery.setIsQueryTotal(true); 
			Integer parentId =null;
			Integer upParentId =null;
			List<User> playerUserList = userService.getAllPlayerUserList(parentId, upParentId, gameId,pageQuery);
			for (User user : playerUserList) {
				if(user.getParentId()!=null&&user.getParentId()!= 0){
					User puser= userService.getById(user.getParentId());
					user.setParentId(puser.getGameUserId());
				}
			}
			result.setPage(pageQuery.getPageIndex());
			result.setTotal(pageQuery.getTotalCount());
			result.setRows(playerUserList);
		} catch (Exception e) {
			logger.error("代理列表", e);
		}
		return JsonUtil.toJson(result) ;
	}
	// 查询单个玩家信息
	@RequestMapping("/query_user_info")
	@ResponseBody
	public String queryUserInfo(HttpServletRequest request,ModelMap model) {
		try {
			String id = request.getParameter("userId");
			User user = userService.getById(id);
			if(user!=null){
				user.setPassword(null);
				model.put("user", user);
			}
		} catch (Exception e) {
			logger.error("用户信息", e);
		}
		return JsonUtil.toJson(model);
	}
	
	
	/**
	 * 个人信息保存
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/user_edit_parentId",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String doEditUserParentId(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			User user = (User)request.getSession().getAttribute("userSession");
			if(!StringUtil.equals(user.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				bootJsonResponse.setMessage(" 权限不够，请联系管理员 ");
				return JsonUtil.toJson(bootJsonResponse); 
			}
			String userId =request.getParameter("userId");
			String pgameId = request.getParameter("pgameId");
			if(StringUtil.isEmpty(pgameId)){
				bootJsonResponse.setMessage("邀请人游戏ID不能为空~");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				return JsonUtil.toJson(bootJsonResponse);
			}
			User newUser=userService.getById(userId);
			
			// 判断是否被占用
			User gameUser = userService.getUserInfoByGameid(pgameId);
			if(gameUser==null){
				bootJsonResponse.setMessage("绑定的玩家信息为空~");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				return JsonUtil.toJson(bootJsonResponse);
			}
			if( gameUser.getGameUserId()==Integer.valueOf(pgameId)){
				bootJsonResponse.setMessage("已经绑定次玩家，切勿重新绑定~");
				bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
				return JsonUtil.toJson(bootJsonResponse);
			}
			newUser.setParentId(gameUser.getId());
			gameUser.setParentNub(newUser.getParentNub()+1);
			if(gameUser.getParentId()!=null&&gameUser.getParentId()!=0){
				newUser.setUpParentId(gameUser.getParentId());
				// 修改下属父ID
				List<User> userList =userService.getUserListByParentId(newUser.getId());
				gameUser.setUpParentNub(newUser.getUpParentNub()+userList.size());
				for (User  suser : userList) {
					suser.setUpParentId(gameUser.getId());
					userService.updateByPrimaryKeySelective(suser);
				}
			}
			
			userService.updateByPrimaryKeySelective(newUser);
			userService.updateByPrimaryKeySelective(gameUser);
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	
	// 超管修改代理商信息
	@RequestMapping("/query_agent_user_info")
	public String queryAgentUserInfo(HttpServletRequest request,ModelMap model) {
		try {
			User sessionUser = (User)request.getSession().getAttribute("userSession");
			String id = request.getParameter("userId");
			User user = userService.getById(id);
			if(user!=null){
				user.setPassword(null);
				model.put("user", user);
			}
			String prifitLevel = user.getUserType();
			if(StringUtil.equals(sessionUser.getUserType(), UserConstants.USER_TYPE_MANAGE)){
				prifitLevel=null;
			}
			List<ProfitRule> profitRule = profitRuleService.getProfitRuleList(null, prifitLevel);
			model.put("profitRule", profitRule);
		} catch (Exception e) {
			logger.error("用户信息", e);
		}
		return "mobile/user/user_edit";
	}
	
	
	/**
	 * 游戏解锁
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/player_unlock",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String playerUnlock(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			String gameUserId =request.getParameter("gameUserId");
			userService.unlockPayerByGameId(gameUserId);
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	/**
	 * 游戏解锁
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(path="/unlockTable",method=RequestMethod.POST,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String unlockTable(HttpServletRequest request,ModelMap model) {
		BootJsonResponse bootJsonResponse =new BootJsonResponse();
		try {
			userService.unlockTable();
			System.out.println("解锁表");
			bootJsonResponse.setMessage("操作成功");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_SUCCESS);
		} catch (Exception e) {
			bootJsonResponse.setMessage("操作失败，请联系管理员");
			bootJsonResponse.setStatusCode(BootJsonResponse.STATUS_CODE_FAILURE);
			logger.error("修改个人信息失败", e);
		}
		return JsonUtil.toJson(bootJsonResponse);
	}
	
	
}
